home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gsalloc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.9 KB  |  82 lines

  1. /* Copyright (C) 1995, 1998 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gsalloc.h,v 1.2 2000/09/19 19:00:25 lpd Exp $ */
  20. /* Memory allocator extensions for standard allocator */
  21.  
  22. #ifndef gsalloc_INCLUDED
  23. #  define gsalloc_INCLUDED
  24.  
  25. /* The following should not be needed at this level! */
  26.  
  27. #ifndef gs_ref_memory_DEFINED
  28. #  define gs_ref_memory_DEFINED
  29. typedef struct gs_ref_memory_s gs_ref_memory_t;
  30. #endif
  31.  
  32. /*
  33.  * Define a structure and interface for GC-related allocator state.
  34.  */
  35. typedef struct gs_memory_gc_status_s {
  36.     /* Set by client */
  37.     long vm_threshold;        /* GC interval */
  38.     long max_vm;        /* maximum allowed allocation */
  39.     int *psignal;        /* if not NULL, store signal_value */
  40.                 /* here if we go over the vm_threshold */
  41.     int signal_value;        /* value to store in *psignal */
  42.     bool enabled;        /* auto GC enabled if true */
  43.     /* Set by allocator */
  44.     long requested;        /* amount of last failing request */
  45. } gs_memory_gc_status_t;
  46. void gs_memory_gc_status(P2(const gs_ref_memory_t *, gs_memory_gc_status_t *));
  47. void gs_memory_set_gc_status(P2(gs_ref_memory_t *, const gs_memory_gc_status_t *));
  48.  
  49. /* ------ Initialization ------ */
  50.  
  51. /*
  52.  * Allocate and mostly initialize the state of an allocator (system, global,
  53.  * or local).  Does not initialize global or space.
  54.  */
  55. gs_ref_memory_t *ialloc_alloc_state(P2(gs_raw_memory_t *, uint));
  56.  
  57. /*
  58.  * Add a chunk to an externally controlled allocator.  Such allocators
  59.  * allocate all objects as immovable, are not garbage-collected, and
  60.  * don't attempt to acquire additional memory (or free chunks) on their own.
  61.  */
  62. int ialloc_add_chunk(P3(gs_ref_memory_t *, ulong, client_name_t));
  63.  
  64. /* ------ Internal routines ------ */
  65.  
  66. /* Prepare for a GC. */
  67. void ialloc_gc_prepare(P1(gs_ref_memory_t *));
  68.  
  69. /* Initialize after a save. */
  70. void ialloc_reset(P1(gs_ref_memory_t *));
  71.  
  72. /* Initialize after a save or GC. */
  73. void ialloc_reset_free(P1(gs_ref_memory_t *));
  74.  
  75. /* Set the cached allocation limit of an alloctor from its GC parameters. */
  76. void ialloc_set_limit(P1(gs_ref_memory_t *));
  77.  
  78. /* Consolidate free objects. */
  79. void ialloc_consolidate_free(P1(gs_ref_memory_t *));
  80.  
  81. #endif /* gsalloc_INCLUDED */
  82.